﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DevelopmentKit.Cms.Enums;
using SharpArch.Domain.DomainModel;

namespace DevelopmentKit.Cms.Domain
{
    /// <summary>
    /// 内容定义 的字段属性
    /// </summary>
    public class ContentProperty:Entity
    {
        /// <summary>
        /// 名称
        /// </summary>
        [Display(Name = "名称")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(128, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Name { get; set; }
        /// <summary>
        /// 显示名称
        /// </summary>
        [Display(Name = "显示名称")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(10, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string Display { get; set; }
        /// <summary>
        /// 输入提示信息
        /// </summary>
        [Display(Name = "输入提示信息")] 
        [StringLength(50, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string InputMessage { get; set; }
        /// <summary>
        /// 验证
        /// </summary>
        [Display(Name = "数据验证")]
        public virtual IList<PropertyValid> PropertyValids{ get; set; }
        /// <summary>
        /// 默认值
        /// </summary>
        [Display(Name = "默认值")] 
        [StringLength(4000, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string DefaultValue { get; set; }
        /// <summary>
        /// 多选值,多个用,分割
        /// </summary>
        [Display(Name = "多选值")] 
        [StringLength(500, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string MultipleValue { get; set; }
        /// <summary>
        /// 可上传的文件扩展名 使用文件/照片/相册类型时有效,多个用,分割
        /// </summary>
        [Display(Name = "允许上传的文件扩展名")]
        [StringLength(500, ErrorMessage = "{0}取值长度{1}~{2}个字符", MinimumLength = 0)]
        public virtual string AllowExtensions { get; set; }
        /// <summary>
        /// 属性类型
        /// </summary>
        [Display(Name = "属性类型")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual PropertyType PropertyType { get; set; } 
        /// <summary>
        /// 内容定义
        /// </summary>
        [Display(Name = "内容定义")]
        [Required(ErrorMessage = "{0}不能为空")]
        public virtual Definition Definition { get; set; }
    }
}